<?php

namespace App\Jobs;
use App\Facades\Site;
use App\Jobs\Job;
use App\Models\Personal\ResumeSend;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Sms;

class CompanyResumeSmsPush extends Job implements ShouldQueue{
    use InteractsWithQueue, SerializesModels;
    protected $resumeData;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($resumeData){
        $this->resumeData = $resumeData;
    }
    /**
     * Execute the job
     * @return void
     */
    public function handle(){
        $this->config();
        //获取当前投递记录
        $result = ResumeSend::where('id',$this->resumeData->send_id)->first(['status']);
        if($result->status == 0){
            //模板参数
            $smsParam = array(
                'job_title' => $this->resumeData->job_title,
                'name' => $this->resumeData->name
            );
            $smsTemplateCode =Site::get('ResumeNoticeTemp');
            $smsFreeSignName =Site::get('ResumeNotice');
            Sms::codeSend($this->resumeData->phone, $smsParam,$smsTemplateCode,$smsFreeSignName);
        }else{
           return ;
        }
    }
}

